#pragma once
#include <string>
#include "AbstractIRequest.h"
#include "AbstractIResonser.h"

/*服务抽象接口*/
class AbstractHTTPServer
{
public:

	inline AbstractHTTPServer() {};

	virtual ~AbstractHTTPServer() {};
	/*
	* 回调函数接口
	*/
	virtual int onRequestDataReceived(AbstractIRequest* request, size_t bytesTransfered) = 0;
	virtual int onResponderDataSent(AbstractIResonser *responder, size_t bytesTransfered) = 0;
	virtual void onRequest(AbstractIRequest* request, int status) = 0;
	virtual void onResponder(AbstractIResonser *responder, int status) = 0;

	/*
	* 获取SERVER信息
	*/
	virtual bool mapServerFilePath(const std::string& url, std::string& serverPath) = 0;
	virtual std::string tmpFileName() = 0;
	virtual const std::string& docRoot() = 0;
	virtual bool isDirectoryVisible() = 0;
	virtual const std::string& defaultFileNames() = 0;
	virtual const std::string& ip() = 0;
	virtual unsigned int port() = 0;
	virtual unsigned int maxConnectionsPerIp() = 0;
	virtual unsigned int maxConnections() = 0;
	virtual unsigned int maxConnectionSpeed() = 0;
	virtual unsigned long sessionTimeout() = 0;
	virtual unsigned long recvTimeout() = 0;
	virtual unsigned long sendTimeout() = 0;
	virtual unsigned long keepAliveTimeout() = 0;

private:

	AbstractHTTPServer(const AbstractHTTPServer &);

	AbstractHTTPServer & operator = (const AbstractHTTPServer &);

};

